<script src="../../../../public/js/moment.js"></script>{extend name="Public/layout2.html"}
{block name='body'}
<blockquote class="layui-elem-quote">
    <span class="layui-breadcrumb">
  					<a href="../">首页</a>
  					<a><cite>统计信息</cite></a>
					</span>
</blockquote>
<fieldset class="layui-elem-field layui-field-title">
    <legend>加班休息</legend>
</fieldset>

<div class="layui-form-pane" style="margin: 15px">
    <div class="layui-form-pane" style="margin-top: 15px;">

        <div class="layui-form-item">

            <label class="layui-form-label">范围选择</label>
            <div class="layui-input-inline">
                <input class="layui-input" placeholder="开始日" id="dates">
            </div>
            <div class="layui-input-inline">
                <input class="layui-input" placeholder="截止日" id="datee">
            </div>
            <button class="layui-btn"onclick="serbytime(0)" ><i class="layui-icon">&#xe615; </i>搜索</button>
            <button class="layui-btn"onclick="serbytime(7)" ><i class="layui-icon">&#xe615; </i>最近7天</button>
            <button class="layui-btn"onclick="serbytime(30)" ><i class="layui-icon">&#xe615; </i>最近30天</button>
            <button class="layui-btn"onclick="refreshTable()" ><i class="layui-icon">&#xe63d; </i>刷新</button>
        </div>
    </div>
    <table class="layui-table" id="table1">

        <thead>
        <tr>

            <th>人员</th>
            <th>工时</th>
            <th>加班</th>
            <th>休息</th>

        </tr>
        </thead>

    </table>
</div>

{/block}}
{block name='jslink'}
{__block__}
<script type="text/javascript"  src="__PUBLIC__/js/moment.js"> </script>
<script>
    $(function () {

        var laydate = layui.laydate;

        var start = {
            format: 'YYYY-MM-DD ', //日期格式
            max: '2099-06-16 23:59:59'

            , istoday: false
            , choose: function (datas) {
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };

        var end = {
            format: 'YYYY-MM-DD ', //日期格式
            min: laydate.now()

            , max: '2099-06-16 23:59:59'
            , istoday: false
            , choose: function (datas) {
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };

        document.getElementById('dates').onclick = function () {
            start.elem = this;
            laydate(start);
        };
        document.getElementById('datee').onclick = function () {
            end.elem = this;
            laydate(end);
        }
    });


</script>
<script type="text/javascript">

    function refreshTable() {
//        table.settings()[0].ajax.data=null;
        table.ajax.reload(null, false);
    }

function serbytime(timenum) {
    if (timenum) {
        $('#dates').val( moment().add(-timenum,'days').format('YYYY-MM-DD'));
        $('#datee').val( moment().add(-0,'days').format('YYYY-MM-DD'));
    }

    var stime=$('#dates').val();
    var dtime=$('#datee').val();
    var param2 = {
        "stime": stime,
        "dtime": dtime
    };
    table.settings()[0].ajax.data=param2;
//        table.ajax.params=param2;
    table.ajax.reload();


}
</script>
<script type="text/javascript">


    var table=null;
    $(function () {

    table= $('#table1').DataTable({
    'ajax':
        {"url":"{:url('index/stats/getlist')}",
            "data":{
            "stime":moment().add(-3,'month').format('YYYY-MM-DD'),
                "dtime":moment().format('YYYY-MM-DD')
            }},
    'columns':[
        {'data':'name'},
        {'data':'sumgs', "defaultContent": "无"},//如果内容为空,不设置默认内容的话会报错
        {'data':'jiaban',"defaultContent": "无"},
        {'data':'qingjia',"defaultContent": "无"},

    ],
})


    }


    )
</script>
{/block}













